/**
 *  TiniSatJ :: A Java implemented SAT Solver based on Tinisat 0.22
 *
 *  Copyright (C) 2007 KITAGAWA, Satoshi.
 *
 *  Original TiniSat is available from
 *  http://users.rsise.anu.edu.au/~jinbo/tinisat/
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

package com.googlecode.tinisat_j;

public class TiniSatJ {

    /**
    * @param args
    */
    public static void main(String[] args) {
        System.out.println("c TiniSatJ 0.2");
        if (args.length < 1) System.exit(0);

        long tic = System.currentTimeMillis();
        Cnf cnf = new Cnf();
        cnf.parse(args[0]);

        System.out.println("c solving " + args[0]);
        System.out.println("c " + cnf.vc + " variables, " + cnf.cc + " clauses");


        SatSolver solver = new SatSolver(cnf);
        boolean result = solver.run();
        long toc = System.currentTimeMillis();

        if (result) {
            System.out.println("s SATISFIABLE");
        }
        else {
            System.out.println("s UNSATISFIABLE");
        }
        solver.printStats();
        double time = 0.001 * (toc - tic);
        System.out.printf("c solved in %.2f s", time);
        System.exit(result ? 10 : 20);
    }

}
